<script setup>
import { ref } from 'vue'
import FanDatePicker from '..'

const show = ref(true)

const onConfirm = (val) => {
  console.log(val)
}

const onFilter = (list) => {
  list.map(item => {
    if (item.type === 'year') item.text = `${item.text}年`
    else if (item.type === 'month') item.text = `${item.text}月`
    else if (item.type === 'day') item.text = `${item.text}日`
    if (item.children.length) onFilter(item.children)
  })
  return list
}
</script>

<template>
  <demo-block title="基础用法">
    <FanDatePicker v-model:show="show" :min-date="new Date()" :max-date="new Date()" @confirm="onConfirm"
      :filter="onFilter" />
  </demo-block>
</template>
